#ifndef _PBVP_RENDERER_MANAGER_H
#define _PBVP_RENDERER_MANAGER_H

#include <QList>
#include "renderplugin.h"
#include "environment.h"
#include "geometryrenderplugin.h"
#include "volumerenderplugin.h"
#include "proteinrenderplugin.h"

namespace PBVP {
	class DataNode;
	/// Render Manager
	/** 
	 *
	 */
	class RenderManager {
	public:
		/// Constructor
		RenderManager();
		/// Destructor
		virtual ~RenderManager();

		/// Add a render plugin 
		void addRenderPlugin(RenderPlugin* pRender);
		
		/// Make the render plugin current
		bool makeRendererCurrent(RenderPlugin* pRender); 

		/// Get the current renderer (render plugin)
		RenderPlugin* getCurrentRenderer() {
			return m_pCurrentRenderer;
		}

		/// Accessors
		Environment& environment() {
			return *m_pEnv;
		}
		const Environment& environment() const {
			return *m_pEnv;
		}

		void setEnvironment(const Environment& env) {
			*m_pEnv = env;
		}

		/// 
		QList<RenderPlugin *> getRenderPlugins() const {
			return m_RendererList;
		} 
		/// 
		void getGeometryRenderPlugins(QList<GeometryRenderPlugin *>& geoRenderlist) const; 

		/// 
		void getVolumeRenderPlugins(QList<VolumeRenderPlugin *>& volRenderList) const;
		/// <summary>
		/// 
		/// </summary>
		/// <param name="proRenderList"></param>
		void getProteinRenderPlugins(QList<ProteinRenderPlugin *>& proRenderList) const;

		QList<RenderPlugin *> getSupportedPlugins(DataInterface *pData) const;

		/// Set default renderer for the given datanode if available
		void setDefaultRenderer(DataNode *pNode);

	private:
		QList<RenderPlugin*> m_RendererList;
		RenderPlugin *m_pCurrentRenderer;
		/// Global OpenGL rendering environment
		Environment *m_pEnv;
	};
}

#endif